<header id="topbar" class="affix" style="top:60px;">
    <div class="topbar-left">
        <ol class="breadcrumb">
            <li class="crumb-active">
                <a href="#stats/vips/missed/">自助充值管理</a>
            </li>
        </ol>
    </div>
    <div class="topbar-right">
        <a href="#op/recharge/add/" class="btn btn-default btn-sm light fw600 ml10"><span
                class="fa fa-plus pr5"></span>新增充值订单</a>
        <% var btnText = recharge_status.on == 1 ? '关闭' : '开启' %>
        <button class="btn btn-default btn-sm light fw600 ml10" type="button" id="releaseBtn"><%= btnText %></button>
        <div class="ml15 ib va-m" id="toggle_sidemenu_r">
            <a href="#" class="pl5"> <i class="fa fa-sign-in fs22 text-primary"></i>
            </a>
        </div>
    </div>
</header>

<section id="content" class="animated fadeIn">
    <% if(items.length > 0){ %>
    <div class="panel overflow">
        <table class="table table-striped fs13" id="main-list">
            <thead>
                <tr class="bg-light">
                    <th>充值单号</th>
                    <th>用户ID</th>
                    <th>充值方式</th>
                    <th>充值账号</th>
                    <th>充值状态</th>
                    <th>充值金额</th>
                    <th class="sortable" data-field="created_at">充值申请时间</th>
                    <th class="sortable" data-field="updated_at">最后更新时间</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody class="admin-form">
                <% _.each(items, function(item){
                    if (item.recharge_type == 2) {
                        var recharger_no = item.recharger_info.bank_no;
                    } else if (item.recharge_type == 1) {
                        var recharger_no = item.recharger_info.alipay_order_id;
                    } else {
                        var recharger_no = item.recharger_info.wechat_no;
                    }
                %>
                    <tr data-uid="<%= item.user_id %>" data-id="<%= item.id %>">
                        <td><%= item.id %></td>
                        <td><a href="#stats/account/?id=<%= item.user_id %>"><%= item.user_id %></a></td>
                        <td><%= RECHARGE_TYPE[item.recharge_type] %></td>
                        <td><%= recharger_no %></td>
                        <td><%= RECHARGE_STATUS[item.status] %></td>
                        <td><%= item.pay_amount || '-' %></td>
                        <td><%= item.created_at %></td>
                        <td><%= item.updated_at %></td>
                        <td>
                                <a class="glyphicons glyphicons-pencil modify-item" href="javascript:;"></a>
                        </td>
                    </tr>
                <%
                }) %>
            </tbody>
        </table>
    </div>
    <div><div class="pull-left" id="page-tips"></div><div id="paginator"></div></div>
    <% }else{ %>
    <h4 class="text-muted">无数据</h4>
    <% } %>
</section>

<!-- Panel popup -->
<div id="editRechargePanel" class="popup-basic popup-lg bg-none mfp-with-anim mfp-hide">
    <div class="panel">
        <div class="panel-heading">
            <span class="panel-icon"><i class="fa fa-pencil"></i></span>
            <span class="panel-title">提现详情</span>
        </div>
        <div class="panel-body">
            <form id="behavior-form" class="form-horizontal" role="form">
            <div class="form-group">
                <label for="detailId" class="col-md-3 control-label">充值单号：</label>
                <div class="col-md-9">
                    <p class="form-control-static text-muted" id="detailId">
                    </p>
                </div>
            </div>
            <div class="form-group">
                <label for="detailUserId" class="col-md-3 control-label">用户编号：</label>
                <div class="col-md-9">
                    <p class="form-control-static text-muted" id="detailUserId">
                    </p>
                </div>
            </div>
            <div class="form-group">
                <label for="detailType" class="col-md-3 control-label">充值方式：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="detailType">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="detailRechargerInfo" class="col-md-3 control-label">充值信息：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="detailRechargerInfo">

                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="detailRechargeeInfo" class="col-md-3 control-label">收款信息：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="detailRechargeeInfo">

                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="detailCashPrice" class="col-md-3 control-label">充值金额：</label>
                <div class="col-md-3">
                  <input id="detailPayAmount" type="number" min="0" class="form-control" />
                </div>
            </div>
            <div class="form-group">
                <label for="detailCreatedAt" class="col-md-3 control-label">充值申请时间：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="detailCreatedAt">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="detailStatus" class="col-md-3 control-label">充值状态：</label>
                <div class="col-md-9">
                  <p class="form-control-static text-muted" id="detailStatus">
                  </p>
                </div>
            </div>
            <div class="form-group">
                <label for="detailAdminId" class="col-md-3 control-label">操作员：</label>
                <div class="col-md-9">
                    <p class="form-control-static text-muted" id="detailAdminId">
                    </p>
                </div>
            </div>
            </form>
        </div>
        <div class="panel-footer text-right">
            <button class="btn btn-primary" type="button" id="revertRecharge">取消充值</button>
            <button class="btn btn-primary" type="button" id="submitRecharge">完成充值</button>
            <button class="btn btn-primary" type="button" id="submitClose">关闭</button>
        </div>
    </div>
</div>

<!-- Start: Right Sidebar -->
<aside id="sidebar_right" class="nano" style="top: 110px;">
    <div class="p20 admin-form">
        <h4 class="mt5 text-muted fw500">过滤条件：</h4>
        <hr class="short">
        <div class="section mb15">
            <label class="field prepend-icon">
                <input title="用户ID" type="text" id="searchUid" class="gui-input" data-field="user_id" placeholder="用户ID" value="<%= searched.user_id %>">
                <label class="field-icon"><i class="fa fa-tag"></i>
                </label>
            </label>
        </div>
        <h6 class="fw400">申请时间</h6>
        <div class="section row" id="searchCreatedAt">
            <div class="col-md-6">
                <input type="text" class="gui-input datetime-input" data-field="created_at.$gte" data-useless="" placeholder=">=" value="<%= searched.created_at ? searched.created_at.$gte : '' %>">
            </div>
            <div class="col-md-6">
                <input type="text" class="gui-input datetime-input" data-field="created_at.$lte" data-useless="" placeholder="<=" value="<%= searched.created_at ? searched.created_at.$lte : '' %>">
            </div>
        </div>
        <h6 class="fw400">充值方式</h6>
        <div class="section mb15">
            <label class="field select">
                <select id="searchType" name="searchType" data-field="recharge_type">
                    <option value="-1" <%= searched.recharge_type == -1 ? 'selected' : '' %>>所有</option>
                    <option value="1" <%= searched.recharge_type == 10 ? 'selected' : '' %>>支付宝</option>
                    <option value="2" <%= searched.recharge_type == 11 ? 'selected' : '' %>>银行卡</option>
                    <option value="3" <%= searched.recharge_type == 13 ? 'selected' : '' %>>微信</option>
                </select>
                <i class="arrow double"></i>
            </label>
        </div>
        <h6 class="fw400">充值状态</h6>
        <div class="section mb15">
            <label class="field select">
                <select id="searchStatus" name="searchStatus" data-field="status">
                    <option value="-1" <%= searched.status == -1 ? 'selected' : '' %>>所有</option>
                    <% _.each(RECHARGE_STATUS, function(v, k){ %>
                    <option value="<%= k %>" <%= searched.status == k ? 'selected' : '' %>><%= v %></option>
                    <% }) %>
                </select>
                <i class="arrow double"></i>
            </label>
        </div>
        <hr class="short">

        <div class="row">
            <div class="col-md-6">
                <button class="btn btn-primary btn-block form-control" id="search">搜索</button>
            </div>
            <div class="col-md-6">
                <button class="btn btn-default btn-block form-control" id="export">导出</button>
            </div>
        </div>

    </div>
</aside>
<!-- End: Right Sidebar -->
